package cn.dm.config;


import com.dm.intercept.ExceptionIntercept;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class InterceptorConfid extends WebMvcConfigurerAdapter {

    @Bean
    public ExceptionIntercept exceptionIntercept(){
        return new ExceptionIntercept();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(exceptionIntercept()).addPathPatterns("/api/**");
        super.addInterceptors(registry);
    }
}
